<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>用户登录</title>
    <link rel="icon" href="../assets/image/favicon.ico" type="image/x-icon" />
    <link type="text/css" rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css" >
    <link type="text/css" rel="stylesheet" href="../themes/css/login.css"/>
    <script type="text/javascript" src="../plugins/jquery/jquery-2.1.4-min.js"></script>
    <script type="text/javascript" src="../plugins/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../plugins/angular/angular.min.js"></script>
    <script>
        var loginMod = angular.module('loginMod', []);
        loginMod.controller('loginCtrl', function($scope,$http) {
            $scope.user = {};
            $scope.imgPath = "";
            $scope.doLogin = function() {
                $http.post("login", $.param($scope.user),{headers:{'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'}}
                ).success(function(data, status, headers, config){
                    if(data.status == 0){
                        location.href = "/views/main.html";
                    } else {
                        console.log("Error in login!")
                    }
                });
            };
        });
    </script>
</head>

<body ng-app="loginMod" ng-controller="loginCtrl">
<div class="main_box">
    <form class="form-horizontal w5c-form" w5c-form-validate="vm" name="loginForm" novalidate>
        <div class="setting input-group">
            <a href="javascript:;" onclick="choose_bg();" title="更换背景">
                <span class="fa fa-large"></span>
            </a>
        </div>
        <div class="login_logo input-group">
            <img src="../themes/images/logo.png">
        </div>
        <div class="input-group">
            <span class="input-group-addon" id="sizing-addon1"><i class="fa fa-user"></i></span>
            <input type="text" class="form-control" id="username" name="username" ng-model="user.username" placeholder="帐号"
                   aria-describedby="sizing-addon1" required autofocus>
        </div>
        <P></P>

        <div class="input-group">
            <span class="input-group-addon" id="sizing-addo2"><i class="fa fa-lock"></i></span>
            <input type="password" class="form-control" id="password" name="password" ng-model="user.password" placeholder="密码"
                   aria-describedby="sizing-addon2" required autofocus>
        </div>
        <P></P>

        <p class="form-group-sm">
            <input type="checkbox" value="remember-me"> &nbsp;&nbsp; 忘记密码
        </p>

        <p class="text-center">
            <button class="btn btn-primary" type="submit" ng-click="doLogin();">登陆</button>
            <label class="control-label">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</label>
            <button class="btn btn-primary" type="button">重置</button>
        </p>
    </form>
</div>
</body>
</html>